home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / gdm / PreSession / Default
Encoding:
Text File  |  2006-10-20  |  2.3 KB  |  85 lines

  1. #!/bin/sh
  2. #
  3. # Note that any setup should come before the sessreg command as
  4. # that must be 'exec'ed for the pid to be correct (sessreg uses the parent
  5. # pid)
  6. #
  7. # Note that output goes into the .xsession-errors file for easy debugging
  8. #
  9. PATH="/usr/X11R6/bin:$PATH:/bin:/usr/bin"
  10. OLD_IFS=$IFS
  11.  
  12. gdmwhich () {
  13.   COMMAND="$1"
  14.   OUTPUT=
  15.   IFS=:
  16.   for dir in $PATH
  17.   do
  18.     if test -x "$dir/$COMMAND" ; then
  19.       if test "x$OUTPUT" = "x" ; then
  20.         OUTPUT="$dir/$COMMAND"
  21.       fi
  22.     fi
  23.   done
  24.   IFS=$OLD_IFS 
  25.   echo "$OUTPUT"
  26. }
  27.  
  28. # Set background color
  29. XSETROOT=`gdmwhich xsetroot`
  30. if [ "x$XSETROOT" != "x" ] ; then
  31.  
  32.     CHECKBACKCOLOR="OK"
  33.     if [ "x$GDM_GREETER_TYPE" = "xTHEMED" ]; then
  34.         BACKCOLOR=`gdmflexiserver --command="GET_CONFIG greeter/GraphicalThemedColor $DISPLAY"`
  35.  
  36.         CHECKBACKCOLOR=`echo $BACKCOLOR | sed 's/^\([^ ]*\) .*$/\1/'`
  37.         if [ "x$CHECKBACKCOLOR" = "xOK" ]; then
  38.             BACKCOLOR=`echo $BACKCOLOR | sed 's/^.* \(.*\)$/\1/'`
  39.         else
  40.             BACKCOLOR=""
  41.         fi
  42.     fi
  43.  
  44.     # If we tried to load the themed backgroundcolor, but failed, then try loading plain color
  45.     if [ "x$CHECKBACKCOLOR" != "xOK" ] || [ "x$GDM_GREETER_TYPE" = "xPLAIN" ]; then
  46.  
  47.         # Background type can be 0=None, 1=Image & Color, 2=Color, or 3=Image 
  48.         BACKTYPE=`gdmflexiserver --command="GET_CONFIG greeter/BackgroundType $DISPLAY"`
  49.  
  50.         # Skip if background type does not include a color
  51.         if [ "x$BACKTYPE" = "xOK 1" ] || [ "x$BACKTYPE" = "xOK 2" ]; then
  52.             BACKCOLOR=`gdmflexiserver --command="GET_CONFIG greeter/BackgroundColor $DISPLAY"`
  53.  
  54.             CHECKBACKCOLOR=`echo $BACKCOLOR | sed 's/^\([^ ]*\) .*$/\1/'`
  55.             if [ "x$CHECKBACKCOLOR" = "xOK" ]; then
  56.                 BACKCOLOR=`echo $BACKCOLOR | sed 's/^.* \(.*\)$/\1/'`
  57.             else
  58.                 BACKCOLOR=""
  59.             fi
  60.         fi
  61.     fi
  62.  
  63.     # Default value
  64.      if [ "x$BACKCOLOR" = "x" ]; then
  65.          BACKCOLOR="#76848F"
  66.      fi
  67.  
  68.     "$XSETROOT" -cursor_name left_ptr -solid "$BACKCOLOR"
  69. fi
  70.  
  71.  
  72. SESSREG=`gdmwhich sessreg`
  73. if [ "x$SESSREG" != "x" ] ; then
  74.     # some output for easy debugging
  75.     echo "$0: Registering your session with wtmp and utmp"
  76.     echo "$0: running: $SESSREG -a -w /var/log/wtmp -u /var/run/utmp -x \"$X_SERVERS\" -h \"$REMOTE_HOST\" -l \"$DISPLAY\" \"$USER\""
  77.  
  78.     exec "$SESSREG" -a -w /var/log/wtmp -u /var/run/utmp -x "$X_SERVERS" -h "$REMOTE_HOST" -l "$DISPLAY" "$USER"
  79.     # this is not reached
  80. fi
  81.  
  82. # some output for easy debugging
  83. echo "$0: could not find the sessreg utility, cannot update wtmp and utmp"
  84. exit 0
  85.